package Mybatis;


import com.yyge.config.SpringConfig;
import com.yyge.entity.AddrInfo;
import com.yyge.mapper.AddrInfoMapper;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.List;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {SpringConfig.class})
public class MyAdvice {
    @Autowired
    private AddrInfoMapper mapper;

    @Test
    public void testSelectALl(){
        List<AddrInfo> list=mapper.selectAll();
        list.forEach(System.out::println);
    }

    @Test
    public void test2(){
        /*
        * AccountMaper是一个接口；因此mybatis为接口提供了实现类；本质上也是一个代理 MapperProxy
        * 当使用AOP增强了AccountMapper(切入点匹配到的)；AOP为MapperProxy创建代理
        * 通过JDK内置的Proxy动态代理来产生的
        * */
        System.out.println(mapper);// class com.sun.proxy.$Proxy38
    }

    @Test
    public void test3(){

    }
}
